﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using KeRui.BLL;
using KeRui.Common;
using System.Text;

public partial class Manage_Cms_FieldPlusList : System.Web.UI.Page
{
    protected DataTable dtClasses;
    protected void Page_Load(object sender, EventArgs e)
    {
        //hyc
        ManageHelper.CheckAdminLogin();
        //权限
        ManageHelper.CheckAdminPower("system_fieldspluslist");
        KeRui.BLL.CmsFieldAttr bllCmsFieldAttr = new CmsFieldAttr();
        dtClasses = bllCmsFieldAttr.GetClassList();
        switch (PageRequest.GetString("act"))
        {
            case "delete":
                //权限
                ManageHelper.CheckAdminPower("system_fieldspluslistdelete");
                bllCmsFieldAttr.Delete(PageRequest.GetString("class"));
                //日志HYC
                ManageHelper.AddLog("system_fieldspluslistdelete","删除了字段附加属性");
                Response.Redirect("FieldPlusList.aspx");
                Response.End();
                break;
        }
    }

    protected string BuildAttrValue(string className)
    {
        StringBuilder sb = new StringBuilder();
        KeRui.BLL.CmsFieldAttr bllCmsFieldAttr = new CmsFieldAttr();
        List<KeRui.Model.CmsFieldAttr> list = bllCmsFieldAttr.GetList("ClassName='" + className + "'");
        for (int i = 0; i < list.Count; i++)
        {
            if (i != list.Count - 1)
            {
                sb.AppendFormat("{0},", list[i].AttributeName);
            }
            else
            {
                sb.AppendFormat("{0}", list[i].AttributeName);
            }
        }
        return sb.ToString();
    }
}
